package com.ff.neuropp.domain;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ff.neuropp.util.DateSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "t_course")
/**
 *  课程表
 * @author sun_weiwu
 *
 */
@ApiModel
public class Course {
	 private static final long serialVersionUID = 1L;

	    @Id
	    @GeneratedValue(strategy = GenerationType.IDENTITY)
	    private int id;

	    @OneToOne
		@JoinColumn(name = "category_id")
		@ApiModelProperty(value = "课程分类Id")
		private CourseCategory category;

		@Column(name = "category_name")
		@ApiModelProperty(value = "课程分类名称")
		private String categoryName;


	    @Column(name = "course_name")
	    @ApiModelProperty(value = "课程名称")
	    private String courseName;


	    @Column(name = "course_image")
	    @ApiModelProperty(value = "课程图片")
	    private String courseImage;

	    @Column(name = "intro")
	    @ApiModelProperty(value = "简介")
	    private String intro;

	    @Column(name = "seat_total")
	    @ApiModelProperty(value = "座位总数")
	    private Integer seatTotal ;

	    @Column(name = "seating_count")
	    @ApiModelProperty(value = "占座数")
	    private Integer seatingCount ;

	    @Column(name = "course_desc")
	    @ApiModelProperty(value = "课程描述")
	    private String courseDesc;
	  
	    @OneToOne
		@JoinColumn(name = "mentor_id")
		@ApiModelProperty(value = "老师")
		private Mentor mentor;

	    @Column(name = "course_location")
	    @ApiModelProperty(value = "课程地点")
	    private String courseLocation;


	    @Column(name = "course_price")
	    @ApiModelProperty(value = "课程价格")
	    private String coursePrice;

	    @Column(name = "is_can_coupon")
	    @ApiModelProperty(value = "是否优惠 1、是 0、否")
	    private Integer isCanCoupon;
	    
	/*
	 * @Column(name = "course_time")
	 * 
	 * @ApiModelProperty(value = "课程时间(列如 :14:00-17:00)") private String courseTime;
	 */

	    //多个优惠Id
	    @OneToMany(cascade = {CascadeType.DETACH})
	    @JoinColumn(name = "course_id")
	    private List<Coupon> couponList;

	    //多个作业id
	    @OneToMany(cascade = {CascadeType.DETACH})
	    @JoinColumn(name = "course_id")
	    private List<Work> workList;

//	    //多个课件id
	    @OneToMany(cascade = {CascadeType.DETACH})
	    @JoinColumn(name = "course_id")
	    private List<CourseWare> courseWareList;
	    
//	    //课程时间表
	    @OneToMany(cascade = {CascadeType.ALL})
	    @JoinColumn(name = "course_id")
	    private List<CourseDate> courseDateList;
	    

	    @Column(name = "serve_fee")
	    @ApiModelProperty(value = "服务费")
	    private String serveFee;


	    @Column(name = "course_level")
	    @ApiModelProperty(value = "课程等级 1、初级2、中级 3、高级")
	    private Integer courseLevel;

	    @Column(name = "careerId")
	    @ApiModelProperty(value = "职业见解ID")
	    private String careerId;

	    @Column(name = "career_point")
	    @ApiModelProperty(value = "课程积分")
	    private String careerPoint;

	    @Column(name = "course_status")
	    @ApiModelProperty(value = "课程状态 0下线  1 默认正常")
	    private Integer status=1;

	    //操作时间
	    @Column(updatable = false)
	    @org.hibernate.annotations.CreationTimestamp
		@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
		@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	    private Date createDate;

	    @Column(name = "update_time")
	    private Date updateTime;

}
